/**
 * 
 */
package com.agrec.client;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * @author Alaa Gharbawi
 * Gets and Shows the Logos of the Companies KMR works with
 *
 */
public class AffiliatedCompanies extends Composite implements KMRPage {

	private Grid grid;
	private int row = 3, col = 3;
	private List<Image> logos;
	
	public AffiliatedCompanies() {
		logos = getLogos();
		int index = 0;
		
		//get images 
		grid = new Grid(row,col);
		//grid.setStylePrimaryName("workWith");
		grid.setCellSpacing(50);
		
		for (int i = 0; i < row; i++) {
			for (int j = 0; j < col; j++) {
				grid.setWidget(i, j, logos.get(index));
				index += 1;
			}
		}
		
		initWidget(grid);
	}

	private List<Image> getLogos() {
		
		//these logos will come from Database maybe or just save some in the image directory
		List<Image> logos = new ArrayList<Image>();
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		logos.add(new Image("images/unilever_logo.gif"));
		
		return logos;
	}

	/* (non-Javadoc)
	 * @see com.agrec.client.KMRPage#historyName()
	 */
	//@Override
	public String historyName() {
		//String name = this.getClass().getName();
		//System.out.println(name.substring(name.lastIndexOf(".")+1, name.length()));
		return "AffiliatedCompanies";
	}

	/* (non-Javadoc)
	 * @see com.agrec.client.KMRPage#update()
	 */
	//@Override
	public void update() {
		// TODO Auto-generated method stub

	}

}
